package com.sike.netty.im.client.handler;

import cn.hutool.core.date.DateUtil;
import com.sike.netty.im.client.event.CustomEvent;
import com.sike.netty.im.client.event.EventFactory;
import com.sike.netty.im.common.command.CreateGroupResponseCommand;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
import lombok.extern.slf4j.Slf4j;

import java.util.Scanner;

/**
 * 创建群聊响应 handler
 *
 * @author chenssy
 * @date 2023/09/18
 */
@Slf4j
public class CreateGroupResponseHandler extends SimpleChannelInboundHandler<CreateGroupResponseCommand> {

    @Override
    protected void channelRead0(ChannelHandlerContext ctx, CreateGroupResponseCommand msg) throws Exception {
        System.out.println("[" + DateUtil.now() + "]：系统 >>> 群创建成功，id 为[" + msg.getGroupId() + "],群名称为[" + msg.getGroupName() + "]");
        System.out.println("[" + DateUtil.now() + "]：系统 >>> 群成员有:" + String.join(",",msg.getGroupMemberList()));
    }
}
